package com.lei.baselibrary.base.presenter

import android.content.Context
import com.lei.baselibrary.base.presenter.view.BaseView
import com.lei.baselibrary.base.utils.NewWorkUtils
import com.trello.rxlifecycle.LifecycleProvider
import javax.inject.Inject

/**
 * @ProjectName : MyMall
 * @Author : 雷金泷
 * @Time : 2021/2/25 11:17
 * @Description : 文件描述
 */
open class BasePresenter<T:BaseView> {
    lateinit var mView:T

    @Inject
    lateinit var lifecycleProvider:LifecycleProvider<*>

    @Inject
    lateinit var context: Context

    fun checkNetWork():Boolean{
        if (NewWorkUtils.isNetWorkAvailable(context)){
            return true
        }
        mView.onError("网络不可用")
        return false
    }
}